package com.oocl.ha.merchant.service.impl;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.oocl.ha.dao.MerchantDao;
import com.oocl.ha.entity.Merchant;
import com.oocl.ha.merchant.service.MerchantManager;

@Service("mmm")
@Transactional
public class MerchantManagerImpl implements MerchantManager {
	
	@Autowired
	MerchantDao md;

	public Merchant merchantLogin(String account, String password) {
		Merchant merchant=md.merchantLogin(account, password);
		return merchant;
	}

	public int merchantRegister(Merchant merchant) {
		int m=md.merchantRegister(merchant);
		return m;
	}

	public boolean merchantIsRegist(String account) {
		boolean isRegist=md.merchantIsRegist(account);
		return isRegist;
	}

	public Merchant findById(int mid) {
		return md.findById(mid);
	}

	public int updateMerchantMsg(Merchant merchant) {
		Merchant m=md.findById(merchant.getMid());
		m.setShopName(merchant.getShopName());
		m.setAddress(merchant.getAddress());
		m.setIcon(merchant.getIcon());
		return 1;
	}

}
